package it.uniroma2.art.coda.converters.default_c;

import it.uniroma2.art.coda.contracts.default_c.DefaultContract;
import it.uniroma2.art.owlart.model.ARTLiteral;
import it.uniroma2.art.owlart.model.ARTNode;
import it.uniroma2.art.owlart.model.ARTNodeFactory;
import it.uniroma2.art.owlart.model.impl.ARTNodeFactoryImpl;

//@Converter(contract=DefaultContract.class)
public class DefaultConverter implements DefaultContract {

	private ARTNodeFactory fact = new ARTNodeFactoryImpl();
	
	@Override
	public ARTNode produceURI(String defaultNamespace, String value) {
		return fact.createURIResource(defaultNamespace + value);
	}

	@Override	
	public ARTLiteral produceLiteral(String datatype, String lang, String value) {
		if (datatype != null) {
			return fact.createLiteral(value, fact.createURIResource(datatype));
		} else if (lang != null){
			return fact.createLiteral(value, lang);
		} else {
			return fact.createLiteral(value);
		}
	}
}
